<%@ page language="java" import="java.util.*,edu.fzu.fundmgr.domain.*" pageEncoding="utf-8"%>
<%
	List<Client> clients = (List<Client>)request.getAttribute("clients");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>客户信息列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<style>
	   .error{
	     color:red;
	   }
	</style>
	
	<script type="text/javascript">
	    function removeFund(idcard_no){
	    
	       if(confirm("您真的要删除编号为 " + id_card_no + " 的消费记录吗?")){
	          
	          location.href = "clientMgr?act=del&idcard_no=" + idcard_no;
	       }
	    }
	    
	    function updateFund(idcard_no){
	    
	       location.href = "clientMgr?act=get_client&idcard_no=" + idcard_no;
	    }
	</script>
	
	<style> 
	  body{
	    padding:10px;
	  }
	</style>
  </head>
  
  <body>
    <h3>客户信息列表</h3>
    <%
    	if(clients.size()> 0){
    %>
    <table border="0">
      <tr>
        <th>身份证号</th>
        <th>客户姓名</th>
        <th>性别</th>
        <th>电话</th>
        <th>地址</th>
        <th>电子邮箱</th>
        <th>爱好</th>
        <th>创建时间</th>
      </tr>
      <%
      	for(Client client : clients){
      %>
      <tr>
        <td><%=client.getIdCardNO()%></td>
        <td><%=client.getClientName()%></td>
        <td><%=client.getSex()%></td>
        <td><%=client.getPhone()%></td>
        <td><%=client.getAddress()%></td>
        <td><%=client.getEMail()%></td>
        <td><%=client.getHobby()%></td>
        <td><%=client.getCreatedDate()%></td>
        <td>
          <button onclick="updateFund(<%=client.getIdCardNO()%>);">修改</button>
          <button onclick="removeFund(<%=client.getIdCardNO()%>);">删除</button>
        </td>
      </tr>
      <%} %>
    </table>
    <%}else{ %>
      <span class="error">当前没有任何客户记录!</span>
    <%} %>
  </body>
</html>
